﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Services;
using System.Web.Script.Services;
using SapB1WebPOS.BLL;
using System.Data;
using Newtonsoft.Json;
using SapB1WebPOS.Utils;

namespace SapB1WebPOS
{
    public partial class UserList : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        [WebMethod]
        [ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)]
        public static string GetList(string keySearch)
        {
            try
            {
                string companyDB = string.Empty;

                if (HttpContext.Current.Session["CompanyDB"] != null)
                {
                    companyDB = HttpContext.Current.Session["CompanyDB"].ToString();
                }
                if (companyDB.Length > 0)
                {
                    CommonBLL obj = new CommonBLL();
                    DataSet dsData = obj.GetAllSystemUser(companyDB, keySearch);

                    if (dsData != null)
                    {
                        return JsonConvert.SerializeObject(dsData.Tables[0]);
                    }
                }
            }
            catch (Exception ex)
            {
                Log.WriteException(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "SystemError", ex);
            }
            return string.Empty;
        }
    }
}